package com.ibuonline.b2b.entity;

import java.io.Serializable;

public class ProdAttributeDef implements Serializable {

	private static final long serialVersionUID = -1646084024516467559L;

	//fields
	private java.lang.Integer id;
	private java.lang.Integer attrId;
	private java.lang.Integer catId;
	private java.lang.String ename;
	private java.lang.Integer inputType;
	private java.lang.Boolean required;
	private java.lang.Integer valueType;
	private java.lang.String defaultValue;
	private java.lang.Integer displayOrder;
	private java.lang.String unit;
	private java.lang.Integer attrType;

	//default constructor
	public ProdAttributeDef() {
	}

	//getter
	public java.lang.Integer getId() {
		return id;
	}
	public java.lang.Integer getAttrId() {
		return attrId;
	}
	public java.lang.Integer getCatId() {
		return catId;
	}
	public java.lang.String getEname() {
		return ename;
	}
	public java.lang.Integer getInputType() {
		return inputType;
	}
	public java.lang.Boolean isRequired() {
		return required;
	}
	public java.lang.Integer getValueType() {
		return valueType;
	}
	public java.lang.String getDefaultValue() {
		return defaultValue;
	}
	public java.lang.Integer getDisplayOrder() {
		return displayOrder;
	}
	public java.lang.String getUnit() {
		return unit;
	}
	public java.lang.Integer getAttrType() {
		return attrType;
	}

	//setter
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public void setAttrId(java.lang.Integer AttrId) {
		this.attrId = AttrId;
	}
	public void setCatId(java.lang.Integer catId) {
		this.catId = catId;
	}
	public void setEname(java.lang.String ename) {
		this.ename = ename;
	}
	public void setInputType(java.lang.Integer inputType) {
		this.inputType = inputType;
	}
	public void setRequired(java.lang.Boolean required) {
		this.required = required;
	}
	public void setValueType(java.lang.Integer valueType) {
		this.valueType = valueType;
	}
	public void setDefaultValue(java.lang.String defaultValue) {
		this.defaultValue = defaultValue;
	}
	public void setDisplayOrder(java.lang.Integer displayOrder) {
		this.displayOrder = displayOrder;
	}
	public void setUnit(java.lang.String unit) {
		this.unit = unit;
	}
	public void setAttrType(java.lang.Integer attrType) {
		this.attrType = attrType;
	}

	//equals method
	public boolean equals(Object other) {
		if (this == other)
			return true;
		if (!(other instanceof ProdAttributeDef))
			return false;

		final ProdAttributeDef prodAttributeDef = (ProdAttributeDef)other;
		if (!this.id.equals(prodAttributeDef.getId()))
			return false;

		return true;
	}

	//hashCode method
	public int hashCode() {
		StringBuffer keys = new StringBuffer();
		keys.append(id).append(",");
		if (keys.length() > 0)
			keys.deleteCharAt(keys.length() - 1);
		return keys.toString().hashCode();
	}

	//toString method
	public String toString() {
		return new StringBuilder("ProdAttributeDef[")
			.append("id=").append(id).append(", ")
			.append("attrId=").append(attrId).append(", ")
			.append("catId=").append(catId).append(", ")
			.append("ename=").append(ename).append(", ")
			.append("inputType=").append(inputType).append(", ")
			.append("required=").append(required).append(", ")
			.append("valueType=").append(valueType).append(", ")
			.append("defaultValue=").append(defaultValue).append(", ")
			.append("displayOrder=").append(displayOrder).append(", ")
			.append("unit=").append(unit).append(", ")
			.append("attrType=").append(attrType).append("]").toString();
	}	
	
	////###################
	private String value;

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
	
	public String getLabel() {
		if (attrId != null) 
			return com.ibuonline.b2b.common.SysCache.getAttributeLabel(attrId);
		return null;
	}
}